import  api  from "./api.js"
import request from'./request.js'
import store from '../store/index';
//获取url 播放音乐
export const checkPlayItem=(item) =>{
	let opts = {
		url: "/song/url",
		method: "get",
	};
	let param = {
		id: item.id,
	};

	api.getAudio(opts, param).then((res) => {

		request.getLyric(item.id).then((ress) => {
			// lyric = ress;
			let audio = {
				id: item.id,
				src: res.data.data[0].url,
				name: item.name,
				picUrl: item.al.picUrl,
				songPlayLycric: ress,
				ar: item.ar,
				al: item.al,
			};
			store.state.audioShow = true
			store.commit('setSrc', audio)
		});
	});
}

export default {
	checkPlayItem
}